﻿//using System;
//using System.Collections.Generic;
//using System.Linq.Expressions;
//using System.Reflection;
//using MongoDAO;
//using MongoDAO.Builders;
//using MongoDB.Bson;
//using MongoDB.Driver.Builders;
//using NUnit.Framework;

//namespace MongoDAOTest
//{
//    [TestFixture]
//    public class AggregateTests
//    {

//        [Test]
//        public void AddKey_Test()
//        {
//            var update = new UpdateBuilder<Foo>();
//            update.Set(x => x.Bar, "A");
//            update.Set(x => x.Name, "B");


//            var group = new GroupBuilder<Foo>();
//            group.AddKey(x => x.Bar);
//            group.AddKey(x => x.Name);
//            Assert.AreEqual("{ Bar : $Bar, Name : $Name }", group);
//        }

//        public BsonDocument GroupId(IEnumerable<BsonElement> bsonElements)
//        {
//            return new BsonDocument("$group", new BsonDocument(bsonElements));
//        }

//        public BsonDocument BsonDocument<T>(Expression<Func<T, object>> memberExpression, object value) where T : TDocument
//        {
//            var member = ((MemberExpression)memberExpression.Body).Member as PropertyInfo;
//            if (member != null)
//            {
//                var propertyType = member.PropertyType;
//                var valueType = value.GetType();
//                if (propertyType != valueType)
//                    throw new ArgumentException("O tipo do valor não corresponde ao tipo da propriedade.", "value");
//                return new BsonDocument(member.Name, BsonValue.Create(value));
//            }
//            return null;
//        }

       
//    }
//}
